home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import operator
- from base.g import *
- from base import device, utils, maint
- from prnt import cups
- from base.codes import *
- from ui_utils import *
- from PyQt4.QtCore import *
- from PyQt4.QtGui import *
- from pqdiagdialog_base import Ui_Dialog
-
- class PQDiagDialog(QDialog, Ui_Dialog):
-
- def __init__(self, parent, device_uri):
- QDialog.__init__(self, parent)
- self.setupUi(self)
- self.device_uri = device_uri
- self.initUi()
- QTimer.singleShot(0, self.updateUi)
-
-
- def initUi(self):
- self.connect(self.CancelButton, SIGNAL('clicked()'), self.CancelButton_clicked)
- self.connect(self.RunButton, SIGNAL('clicked()'), self.RunButton_clicked)
- self.connect(self.DeviceComboBox, SIGNAL('DeviceUriComboBox_noDevices'), self.DeviceUriComboBox_noDevices)
- self.connect(self.DeviceComboBox, SIGNAL('DeviceUriComboBox_currentChanged'), self.DeviceUriComboBox_currentChanged)
- self.DeviceComboBox.setFilter({
- 'pq-diag-type': (operator.gt, 0) })
- self.setWindowIcon(QIcon(load_pixmap('prog', '48x48')))
- if self.device_uri:
- self.DeviceComboBox.setInitialDevice(self.device_uri)
-
-
-
- def updateUi(self):
- self.DeviceComboBox.updateUi()
- self.LoadPaper.setButtonName(self._PQDiagDialog__tr('Run'))
- self.LoadPaper.updateUi()
-
-
- def DeviceUriComboBox_currentChanged(self, device_uri):
- self.device_uri = device_uri
-
-
- def DeviceUriComboBox_noDevices(self):
- FailureUI(self, self._PQDiagDialog__tr('<b>No devices that support print quality diagnostics found.</b><p>Click <i>OK</i> to exit.</p>'))
- self.close()
-
-
- def CancelButton_clicked(self):
- self.close()
-
-
- def RunButton_clicked(self):
- d = None
-
- try:
- d = device.Device(self.device_uri)
- except Error:
- CheckDeviceUI(self)
- return None
- else:
- pqdiag_type = d.pq_diag_type
-
- try:
- d.open()
- except Error:
- CheckDeviceUI(self)
-
- if d.isIdleAndNoError():
- if pqdiag_type == 1:
- maint.printQualityDiagType1(d, (lambda : True))
- elif pqdiag_type == 2:
- maint.printQualityDiagType2(d, (lambda : True))
-
- else:
- CheckDeviceUI(self)
-
- self.close()
-
-
- def __tr(self, s, c = None):
- return qApp.translate('PQDiagDialog', s, c)
-
-
-